﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="dskcn.aspx.cs" Inherits="Doanhnghiep_dskcn" Title="Untitled Page" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    
        
            <p id="divMsgs" runat="server">
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>
            </p>
            
         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
              function showHideForm()
                               {
                                    var imgShowHide = document.getElementById("imgShowHide");
                                    var divNhapLieu = document.getElementById("divNhapLieu");
                                    var tblTimKiem = document.getElementById("tblTimKiem");
                                    if(isShow)
                                    {
                                        isShow = false;                           
                                        myHeight = divNhapLieu.style.height;
                                        divNhapLieu.style.height = "25px";
                                        imgShowHide.src = "../images/qsfConfigUpArrow.png";
                                        tblTimKiem.style.visibility = "hidden";
                                    }else
                                    {
                                        isShow = true;
                                        var imgShowHide = document.getElementById("imgShowHide");
                                        var divNhapLieu = document.getElementById("divNhapLieu");
                                        divNhapLieu.style.height = myHeight;
                                        imgShowHide.src = "../images/qsfConfigDownArrow.png";
                                        tblTimKiem.style.visibility = "visible";
                                    }
                               }

            </script>

        </telerik:RadCodeBlock>
      <fieldset id="divNhapLieu" style="width:300px;">
<legend>
<img  width="20px" height="20px" src="../images/qsfConfigUpArrow.png" style="cursor:pointer" id="imgShowHide" onclick="showHideForm();" align="left"/><strong>Tìm kiếm</strong>
</legend>
<table cellpadding="2" cellspacing="1"  id="tblTimKiem">
<tr style="height: 19px;">
		<td style="width: 151px"><span style="font-size: 9pt; color: #000000;margin-left:20px;">
		Tên:</span>
    </td>
        <td style="width: 369px"><span style="margin-left:40px">
            <telerik:RadTextBox ID="txtTen" runat="server">
            </telerik:RadTextBox></span>
            
        </td>
</tr>
<tr style="height: 19px;">
		<td style="width: 146px"><span style="font-size: 9pt; color: #000000;margin-left:20px">
		Quốc gia:</span>
    </td>
        <td style="width: 369px"><span style="margin-left:40px">
          <telerik:RadTextBox ID="txtqgia" runat="server">
            </telerik:RadTextBox> </span>       
    </td>
</tr>
<tr style="height: 19px;">
		<td style="width: 151px"><span style="font-size: 9pt; color: #000000;margin-left:20px">
		Địa chỉ:</span>
    </td>
        <td style="width: 369px"><span style="margin-left:40px">
            <telerik:RadTextBox ID="txtDiaChi" runat="server">
            </telerik:RadTextBox></span>
        </td>
</tr>
		<tr>
            <td  colspan="2" align="center">
                <table width="100%"><tr><td style="height: 25px"><span style="margin-left:20px">                
                    <telerik:RadButton ID="RadButton1" runat="server" Text="Tìm kiếm" Skin="Hay" OnClick="Button1_Click">
                    </telerik:RadButton>  
                </td>
                </tr></table>
      </td></tr>
    </table>
</fieldset>

         <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid_kcn">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid_kcn" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
        
        
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
        <telerik:RadGrid ID="RadGrid_kcn" runat="server" AllowPaging="True" 
            AllowSorting="True" CellSpacing="0" DataSourceID="SqlDataSource_kcn" 
            GridLines="None" AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemUpdated="RadGrid_kcn_ItemUpdated"
             
           OnItemInserted="RadGrid_kcn_ItemInserted" OnDataBound="RadGrid_kcn_DataBound" Skin="Telerik">
                <HeaderContextMenu></HeaderContextMenu>

                <MasterTableView AutoGenerateColumns="False" DataKeyNames="Makcn" 
                                DataSourceID="SqlDataSource_kcn" CommandItemDisplay="Top">
                                
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>

                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>

    <Columns>
    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
                    
        <telerik:GridBoundColumn DataField="Makcn" DataType="System.Int32"  Visible="false"
            FilterControlAltText="Filter Makcn column" HeaderText="Makcn" ReadOnly="True" 
            SortExpression="Makcn" UniqueName="Makcn">
        </telerik:GridBoundColumn>
        
           <telerik:GridTemplateColumn HeaderText="STT">
                       <ItemTemplate>
                        <asp:Label runat="server" ID="lblSTT" Text='<%#i++%>'></asp:Label>
                       </ItemTemplate>
           </telerik:GridTemplateColumn>
        
       
        
         <telerik:GridBoundColumn DataField="TenKCN" 
            FilterControlAltText="Filter TenKCN column" HeaderText="TenKCN" 
            SortExpression="TenKCN" UniqueName="TenKCN">
        </telerik:GridBoundColumn>
        
        <telerik:GridBoundColumn DataField="Quocgia" 
            FilterControlAltText="Filter Quocgia column" HeaderText="Quocgia" 
            SortExpression="Quocgia" UniqueName="Quocgia">
        </telerik:GridBoundColumn>
        
        <telerik:GridBoundColumn DataField="Namhd" 
            FilterControlAltText="Filter Namhd column" HeaderText="Namhd" SortExpression="Namhd" 
            UniqueName="Namhd">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Diachi" 
            FilterControlAltText="Filter Diachi column" HeaderText="Diachi" 
            SortExpression="Diachi" UniqueName="Diachi">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="NguoiphutrachMT" 
            FilterControlAltText="Filter NguoiphutrachMT column" HeaderText="NguoiphutrachMT" 
            SortExpression="NguoiphutrachMT" UniqueName="NguoiphutrachMT">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Email" 
            FilterControlAltText="Filter Email column" HeaderText="Email" 
            SortExpression="Email" UniqueName="Email">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Website" 
            FilterControlAltText="Filter Website column" HeaderText="Website" 
            SortExpression="Website" UniqueName="Website">
        </telerik:GridBoundColumn>
        
        <telerik:GridButtonColumn ConfirmText="Delete this Quocgia?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
    </Columns>

            <EditFormSettings EditFormType="Template" ColumnNumber="2" CaptionDataField="TenKCN" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Quocgia">
            
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
            
                <FormTemplate>
                    <table id="Table2" style="border-style: none groove none groove; position: relative; margin-left:180px; background-color: #FFFFBB; vertical-align: middle;">
                        <tr class="EditFormHeader">
                            <td colspan="2" style="font-size: small" align="center">
                                <h2><b>NHẬP THÔNG TIN KHU CÔNG NGHIỆP</b></h2>
                            </td>
                        </tr>                      
                        
                             <tr>
                               <td>
                                <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">
                                    <tr>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tên Khu công nghiệp:<br />
                                             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:TextBox ID="txtkcn" runat="server" Text='<%# Bind("TenKCN") %>'>
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                             ErrorMessage="*" ControlToValidate="txtkcn"></asp:RequiredFieldValidator>
                                               
                                        </td>
                                        
                                    </tr>
                                    <tr>
                                  <td>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tên nguyên liệu:<br />
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:TextBox ID="txtQuocgia" runat="server" Text='<%# Bind("Quocgia") %>'>
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ErrorMessage="*" ControlToValidate="txtQuocgia"></asp:RequiredFieldValidator>
                                        </td>
                                        
                                   </tr><tr>   
                                        <td>
                                       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Năm:<br />
                                           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtnam" runat="server" Text='<%# Bind("Namhd") %>' TabIndex="1">
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ErrorMessage="*" ControlToValidate="txtnam"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                       
                                        <td>
                                       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Địa chỉ:<br />
                                          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <asp:TextBox ID="txtDiachi" runat="server" Text='<%# Bind("Diachi") %>' TabIndex="2">
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ErrorMessage="*" ControlToValidate="txtDiachi"></asp:RequiredFieldValidator>
                                        </td>
                                   </tr>
                                     
                                </table>
                            </td>
                          
                      
                        
                            <td>
                                <table id="Table4" cellspacing="1" cellpadding="1" width="250" border="0">
                                    <tr>
                                        
                                        <td>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NguoiphutrachMT:<br />
                                           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtNguoiphutrachMT" Text='<%# Bind( "NguoiphutrachMT") %>' runat="server" TabIndex="8">
                                            </asp:TextBox>
                                            
                                        </td>
                                    </tr>
                                    <tr>
                                       
                                        <td>
                                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Email:<br />
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <asp:TextBox ID="txtEmail" Text='<%# Bind( "Email") %>' runat="server" TabIndex="9">
                                            </asp:TextBox>
                                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ErrorMessage="Email invalid" ControlToValidate="txtEmail" 
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                                        </td>
                                    </tr>
                                  
                                    <tr>
                                      
                                        <td>
                                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Website:<br />
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <asp:TextBox ID="txtweb" Text='<%# Bind( "Website") %>' runat="server" TabIndex="11">
                                            </asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                             ErrorMessage="*" ControlToValidate="txtweb"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            </tr>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" colspan="2">
                                 <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button>&nbsp;
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                  
                                 
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
           </MasterTableView>
           <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>


<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource_kcn" runat="server"
          ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" ProviderName="System.Data.SqlClient"
          SelectCommand="SELECT * FROM [Khucongnghiep]"
           DeleteCommand="DELETE FROM [Khucongnghiep] WHERE [Makcn] = @original_Makcn"
           InsertCommand="INSERT INTO Khucongnghiep(TenKCN, Quocgia,Namhd,Diachi,NguoiphutrachMT,Email,Website) VALUES (@TenKCN,@Quocgia,@Namhd,@Diachi,@NguoiphutrachMT,@Email,@Website)"
           UpdateCommand="UPDATE [Khucongnghiep] SET [TenKCN] = @TenKCN, [Quocgia] = @Quocgia, [Namhd] = @Namhd, [Diachi] = @Diachi,[NguoiphutrachMT]=@NguoiphutrachMT,[Email]=@Email,[Website]=@Website WHERE [Makcn] = @original_Makcn"
           
          OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
         
          
          <DeleteParameters>
               <asp:Parameter Name="original_Makcn" Type="Int32" />
           </DeleteParameters>
           <UpdateParameters>
               <asp:Parameter Name="TenKCN" Type="String" />
               <asp:Parameter Name="Quocgia" Type="String" />
               <asp:Parameter Name="Namhd" Type="String" />
               <asp:Parameter Name="Diachi" Type="String" />
               <asp:Parameter Name="NguoiphutrachMT" Type="String" />
               <asp:Parameter Name="Email" Type="String" />
               <asp:Parameter Name="Website" Type="String" />
               
               <asp:Parameter Name="original_Makcn" Type="Int32" />
               
               
           </UpdateParameters>
           <InsertParameters>                
               
               <asp:Parameter Name="TenKCN" Type="String" />
               <asp:Parameter Name="Quocgia" Type="String" />
               <asp:Parameter Name="Namhd" Type="String" />
               <asp:Parameter Name="Diachi" Type="String" />
               <asp:Parameter Name="NguoiphutrachMT" Type="String" />
               <asp:Parameter Name="Email" Type="String" />
               <asp:Parameter Name="Website" Type="String" />
              
           </InsertParameters>
          
      </asp:SqlDataSource>
    
        
               <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px" />
       <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px" />
       <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px" />
       <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" />
</asp:Content>

